package com.example.schoolexam2.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpSession;

@Slf4j
@ControllerAdvice
public class globalExceptionHandler {
    @ExceptionHandler({ArithmeticException.class,NullPointerException.class})
    public String handlerArithException(Exception e, HttpSession session){
        log.info("捕获的异常是：{}",e);
        return "login";
    }
}
